1   package com.iluwatar;
2   
3   /**
4    * 
5    * Abstract base class for party members.
6    *
7    */
8   public abstract class PartyMemberBase implements PartyMember {
9   
10  	protected Party party;
11  
12  	@Override
13  	public void joinedParty(Party party) {
14  		System.out.println(this + " joins the party");
15  		this.party = party;
16  	}
17  
18  	@Override
19  	public void partyAction(Action action) {
20  		System.out.println(this + " " + action.getDescription());
21  	}
22  
23  	@Override
24  	public void act(Action action) {
25  		if (party != null) {
26  			System.out.println(this + " " + action.toString());
27  			party.act(this, action);
28  		}
29  	}
30  
31  	@Override
32  	public abstract String toString();
33  
34  }